﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using com.yoozoo.gta.Extension;
using Gameplay.PVE.Survivor;
using OWL.Rendering.HRP;
using UnityEditor;
using UnityEngine;
using UnityEngine.Profiling;
using Yoozoo.HRP.Runtime;

public class MapFogBlock : MonoBehaviour
{
    public bool defaultUnlock;
    public int id;
    public List<Transform> points = new List<Transform>();
    public List<Vector3> positions = new List<Vector3>();
    public EFogRenderType renderType = EFogRenderType.Hole;

    public void Rebuild(Vector3 center)
    {
        points.Clear();
        positions.Clear();
        for (int i = 0; i < transform.childCount; i++)
        {
            var child = transform.GetChild(i);
            points.Add(child);
            var pos = child.position - center;
            positions.Add(new Vector3(pos.x, 0, pos.z));
        }
    }
    
    
    public void DrawGizmos()
    {
        for (int i = 0; i < points.Count; i++)
        {
            if (!points[i] || points[(i + 1) % points.Count])
            {
                return;
            }

            Gizmos.color = Color.white;
            Gizmos.DrawLine(points[i].position, points[(i + 1) % points.Count].position);
        }
    }
}